home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: mxsld2.pd.infn.it!LORETI
- From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
- Subject: Re: Function to retrieve full path name of running process?
- X-Nntp-Posting-Host: mxsld2.pd.infn.it
- Message-ID: <DLwuC6.CqJ@news.cern.ch>
- Sender: news@news.cern.ch (USENET News System)
- Reply-To: loreti@mxsld2.pd.infn.it
- Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
- References: <4e330s$o25@news.fmso.navy.mil>
- Date: Sun, 28 Jan 1996 21:28:53 GMT
-
- In article <4e330s$o25@news.fmso.navy.mil>, Carol_Walker@fmso.navy.mil (Carol Walker) writes:
- >Is there a function that a process running on a Unix system can call
- >to determine the full path name of its object file? argv[0] doesn't
- >contain the full path, only the command used to execute it.
- >
- >Thanks in advance.
- >
- >Carol Walker
- >US Navy Fleet Material Support Office
- >Mechanicsburg, PA
- >carol_walker@fmso.navy.mil
- >
-
- You are out of luck. As you know having read the FAQ list before
- posting,
-
- 19.31: How can my program discover the complete pathname to the
- executable from which it was invoked?
-
- A: argv[0] may contain all or part of the pathname, or it may
- contain nothing. You may be able to duplicate the command
- language interpreter's search path logic to locate the
- executable if the name in argv[0] is present but incomplete.
- However, there is no guaranteed solution.
-
- References: K&R1 Sec. 5.11 p. 111; K&R2 Sec. 5.10 p. 115; ANSI
- Sec. 2.1.2.2.1; ISO Sec. 5.1.2.2.1; H&S Sec. 20.1 p. 416.
-
- --
- Maurizio Loreti http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
- Un. of Padova, Dept. of Physics - Padova, Italy loreti@padova.infn.it
-